package com.lizhi.yun.db.stand.pojo;

import com.lizhi.mybatis.boot.Description;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.List;

/**
 * 处方表
 */
@Data
@ToString
@Entity
@Table(name = "stand_prescription_info")
@Description("处方")
public class StandPrescriptionInfoPOJO {

    @Id
    @Column(length = 30)
    @Description("lid")
    public String lid;

    @Column(length = 30)
    @Description("处方id")
    private String preId;

    /*患者信息*/
    @Column(length = 30)
    @Description("患者id")
    private String ptId;

    @Column(length = 200)
    @Description("患者名称")
    private String prePtNm;

    @Column(length = 200)
    @Description("患者年龄")
    private String prePtAge;

    @Column(length = 2)
    @Description("患者性别（00-男，01-女）")
    private String prePtSex;

    @Transient
    @Description("患者性别")
    private String prePtSexText;

    @Column(length = 200)
    @Description("患者证件号")
    private String prePtCerNo;

    @Column(length = 200)
    @Description("处方训练时长（秒）")
    public Integer preDuration;

    @Column(length = 500)
    @Description("创建者")
    private String preCrtBy;

    @Column(length = 500)
    @Description("更新者")
    private String preUpdBy;

    @Column(length = 19)
    @Description("插入时间")
    private String preIstTm;

    @Column(length = 19)
    @Description("更新时间")
    private String preUpdTm;

    @Column(length = 2)
    @Description("状态00-未使用，01-已使用, 02-已删除")
    private String preState;

    @Transient
    @Description("状态")
    private String preStateText;

    @Column(length = 500)
    @Description("治疗师")
    private String preTherape;

    @Column(length = 200)
    @Description("处方训练次数")
    private String preTimes;

    @Column(length = 200)
    @Description("处方已训练次数")
    private String preOldTimes;

    @Column(length = 19)
    @Description("处方开始时间（YYYY-mm-dd HH:mm:ss）")
    private String preStartTm;

    @Column(length = 19)
    @Description("处方结束时间（YYYY-mm-dd HH:mm:ss）")
    private String preEndTm;

    @Column(length = 2)
    @Description("上传状态(00-未上传，01-已上传)")
    private String preUpState;

    @Transient
    @Description("上传状态")
    private String preUpStateText;

    @Column(length = 19)
    @Description("上传时间")
    private String preUpTm;

    @Transient
    @Description("处方记录")
    private List<StandPrescriptionActionPOJO> standPrescriptionActionPOJOS;

    /*云管需要的数据*/
    @Column(length = 200)
    @Description("医院ID")
    private String hospitalId;

    @Column(length = 200)
    @Description("系统ID")
    private String hospitalSystemId;


    public String getPrePtSexText() {
        if ("00".equals(this.prePtSex)){
            this.prePtSexText = "男";
        } else if ("01".equals(this.prePtSex)){
            this.prePtSexText = "女";
        }
        return prePtSexText;
    }

    public String getPreStateText() {
        if ("00".equals(this.preState)){
            this.preStateText = "未使用";
        } else if ("01".equals(this.preState)){
            this.preStateText = "已使用";
        } else if ("02".equals(this.preState)){
            this.preStateText = "已删除";
        }
        return preStateText;
    }

    public String getPreUpStateText() {
        if ("00".equals(this.preUpState)){
            this.preUpStateText = "未上传";
        } else if ("01".equals(this.preUpState)){
            this.preUpStateText = "已上传";
        }
        return preUpStateText;
    }
}